/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.demo;

import java.util.Arrays;
import java.util.stream.Stream;

/**
 * <p>Project: app2022 - Stream4
 * <p>Powered by webrx On 2022-01-26 14:04:43
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Stream4 {
    public static void main(String[] args) {
        var is = Stream.of("java,javascript", "html,css,vue", "mysql,redis", "python,php");
        //is.forEach(System.out::println);
        //System.out.println(is.collect(Collectors.toList()));
        //System.out.println(is.collect(Collectors.joining("-")));

        //map
        //is.map(e -> "hello:".concat(e)).forEach(System.out::println);
        //flatMap
        //is.flatMap(e -> Arrays.stream(e.split(","))).forEach(System.out::println);
        //is.flatMap(e -> Arrays.stream(e.split(","))).peek(e -> System.out.println(e.toUpperCase())).forEach(System.out::println);
        is.flatMap(e -> Arrays.stream(e.split(","))).forEach(e -> System.out.println(e.toUpperCase().concat("\n").concat(e)));
    }
}
